package com.mk.plugin.function;

import com.intellij.openapi.util.text.StringUtil;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class Functions {

    private String fieldName;
    private String fieldDashName;
    private String fieldUnderscoreName;
    private String fieldFirstUpperCamelCaseName;
    private String fieldAllUpperCaseUnderscoreName;
    private String labelText;

    Functions(String fieldName) {
        this.fieldName = fieldName;
        if (fieldName == null || "".equals(fieldName)) {
            this.fieldName = "";
            this.fieldDashName = "";
            this.fieldUnderscoreName = "";
            this.fieldFirstUpperCamelCaseName = "";
            this.fieldAllUpperCaseUnderscoreName = "";
        } else {
            String[] split = fieldName.split("(?<=[a-z])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])");
            this.fieldDashName = StringUtil.join(split, "-");
            this.fieldUnderscoreName = StringUtil.join(split, "_");
            this.fieldFirstUpperCamelCaseName = Arrays.stream(split).map((w) -> Character.toUpperCase(w.charAt(0)) + w.substring(1).toLowerCase()).collect(Collectors.joining());
            this.fieldAllUpperCaseUnderscoreName = this.fieldUnderscoreName.toUpperCase();
        }
    }

    public String getSubviewStatement() {
        return "";
    }

    public List<String> getSubviewProps() {
        return Collections.emptyList();
    }

    public List<String> getExtendviewProps() {
        return Collections.emptyList();
    }

    public List<String> getNeedComponent() {
        return Collections.emptyList();
    }

    public List<String> getNeedMapToProps() {
        return Collections.emptyList();
    }

    public String getRenderComponentString() {
        return "";
    }

    public String getLeftActionComponentString() {
        return "";
    }

    public String getRightActionComponentString() {
        return "";
    }

    public String getActionString(Map<String, Object> properties) {
        return "";
    }

    public String getActionTypeString(Map<String, Object> properties) {
        return "";
    }

    public String getReducerSwitches(Map<String, Object> properties) {
        return "";
    }

    public String getReducerFunctions(Map<String, Object> properties) {
        return "";
    }

    public List<String> getReducerInitState(Map<String, Object> properties) {
        return Collections.emptyList();
    }

    public List<String> getSearchConditionInitState(Map<String, Object> properties) {
        return Collections.emptyList();
    }

    public List<String> getMKComponentImport() {
        return Collections.emptyList();
    }

    public List<String> getCustomImportStatement() {
        return Collections.emptyList();
    }

    public List<String> getReducerImportStatement() {
        return Collections.emptyList();
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public String getFieldDashName() {
        return fieldDashName;
    }

    public void setFieldDashName(String fieldDashName) {
        this.fieldDashName = fieldDashName;
    }

    public String getFieldUnderscoreName() {
        return fieldUnderscoreName;
    }

    public void setFieldUnderscoreName(String fieldUnderscoreName) {
        this.fieldUnderscoreName = fieldUnderscoreName;
    }

    public String getFieldFirstUpperCamelCaseName() {
        return fieldFirstUpperCamelCaseName;
    }

    public void setFieldFirstUpperCamelCaseName(String fieldFirstUpperCamelCaseName) {
        this.fieldFirstUpperCamelCaseName = fieldFirstUpperCamelCaseName;
    }

    public String getFieldAllUpperCaseUnderscoreName() {
        return fieldAllUpperCaseUnderscoreName;
    }

    public void setFieldAllUpperCaseUnderscoreName(String fieldAllUpperCaseUnderscoreName) {
        this.fieldAllUpperCaseUnderscoreName = fieldAllUpperCaseUnderscoreName;
    }

    public String getLabelText() {
        return labelText;
    }

    public void setLabelText(String labelText) {
        this.labelText = labelText;
    }
}
